#include <stdio.h>
#define M 12

int i = 0;
int Isleap(int year)
{
	if((year%4 == 0  &&  year%100 != 0) || year%400 == 0)
	{
		//printf("this year is leap!\n");
		return 1;
	}
	else
	{
		//printf("this year is not leap!\n");
		return 0;
	}
}


int total_day(int year,int month,int day)
{
	static int total = 0;
	int everymon[M]={31,28,31,30,31,30,31,31,30,31,30,31};
	if(month > 1)
	{	
		int m = Isleap(year);
		if(m == 1)
		{
			everymon[1] = everymon[1] +1;
			for(i=0;i<month - 1;i++)
			{
				total = total + everymon[i];
			}
		}
		else
		{
			for(i=0;i<month - 1;i++)
			{
				total = total + everymon[i];
			}
		}
		total = total + day;
		return total;
	}else if(month = 1)
	{
		total = day;
		return total;
	}
}
